package com.gilight.base.util;


import retrofit2.Retrofit;

public class RetrofitUtil {
    public static volatile Retrofit  wxretrofit;
    public static volatile Retrofit  qqMapretrofit;
    public static volatile Retrofit  notyretrofit;

    private RetrofitUtil(){};

    public static Retrofit wxbuild(String baseUrl){
        if(wxretrofit == null){
            synchronized (RetrofitUtil.class){
                if(wxretrofit == null){
                    wxretrofit = new Retrofit.Builder()
                            .baseUrl(baseUrl)
                            .addConverterFactory(FastJsonConverterFactory.create())
                            .build();
                }
            }
        }
        return wxretrofit;
    };
    public static Retrofit qqMapbuild(String baseUrl){
        if(qqMapretrofit == null){
            synchronized (RetrofitUtil.class){
                if(qqMapretrofit == null){
                    qqMapretrofit = new Retrofit.Builder()
                            .baseUrl(baseUrl)
                            .addConverterFactory(FastJsonConverterFactory.create())
                            .build();
                }
            }
        }
        return qqMapretrofit;
    };
    public static Retrofit notybuild(String baseUrl){
        if(notyretrofit == null){
            synchronized (RetrofitUtil.class){
                if(notyretrofit == null){
                    notyretrofit = new Retrofit.Builder()
                            .baseUrl(baseUrl)
                            .addConverterFactory(FastJsonConverterFactory.create())
                            .build();
                }
            }
        }
        return notyretrofit;
    };
    public static Retrofit WxLiteBuile(){
       return wxbuild("https://api.weixin.qq.com");
    }
    public static Retrofit QQMapBuile(){
        return qqMapbuild("https://apis.map.qq.com");
    }
    public static Retrofit NotyBuile(){
        //return notybuild("http://miniapp.tangbantian.com");
        return notybuild("http://localhost:8088");
    }
}
